#ifndef RIGIDBODY_OPENCL_H
#define RIGIDBODY_OPENCL_H

#include <CL/cl_gl.h>

#define __CL_ENABLE_EXCEPTIONS
#define __NO_STD_VECTOR
#include <CL/cl.hpp>

extern cl_float* clBodyMass;
extern cl_float3* clBodyForce;
extern cl_float3* clBodyPosition;
extern cl_float3* clBodyVelocity;
extern cl_float3* clBodyLinearMomentum;
extern cl_float4* clBodyQuaternion;
extern cl_float* clBodyRotationMatrix;
extern cl_float3* clBodyAngularVelocity;
extern cl_float3* clBodyAngularMomentum;
extern cl_float3* clInitialIITDiagonal; //Initial Inverse Inertia Tensor Diagonal
extern cl_float* clBodyInverseInertiaTensor;

extern cl_float* clParticleMass;
extern cl_float3* clParticlePosition;
extern cl_float3* clParticleVelocity;
extern cl_float3* clParticleForce;

void initCL();
void initializeHostDataArrays();
void initializeDeviceBuffers();
void updateHostDataArrays();
void writeHostDataToDevice();
void stepSimulationWithOpenCL();
void initOpenCLGrid();

#endif
